package cn.js.ccit.flowersmall.gift.controller;

import cn.js.ccit.flowersmall.gift.entity.GiftEntity;
import cn.js.ccit.flowersmall.gift.service.GiftService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
//@CrossOrigin(originPatterns = "*", methods = {RequestMethod.GET, RequestMethod.POST})
public class GiftController {
    @Autowired
    GiftService service;
    @GetMapping("/gifts")
    public List<GiftEntity> gifts(){
        return service.findGifts();
    }

    @GetMapping("/gift")
    public GiftEntity product(Long id){
        return service.getGiftById(id);
    }

}
